<template>
  <div class="page-account">
    <div class="page-account-container">
      <div class="page-account-top">
        <div class="page-account-top-logo">
          <!-- <img src="@/assets/images/logo.png" alt="logo" /> -->
        </div>
        <div class="page-account-top-desc">
          数字证书
        </div>
      </div>
      <Login @on-submit="handleSubmit">
        <UserName name="username" value="admin" />
        <Password name="password" value="21232f297a57a5a743894a0e4a801fc3" enter-to-submit />
        <div class="page-account-auto-login">
          <Checkbox v-model="autoLogin" size="large">自动登录</Checkbox>
          <!-- <a href="">忘记密码</a> -->
        </div>
        <Submit />
      </Login>
      <!-- <div class="page-account-other">
        <span>其它登录方式</span>
        <img src="@/assets/svg/icon-social-wechat.svg" alt="wechat" />
        <img src="@/assets/svg/icon-social-qq.svg" alt="qq" />
        <img src="@/assets/svg/icon-social-weibo.svg" alt="weibo" />
        <router-link class="page-account-register" :to="{ name: 'register' }"
          >注册账户</router-link
        >
      </div> -->
    </div>
    <i-copyright />
  </div>
</template>
<script>
    import iCopyright from '@/components/copyright'
    import { mapActions } from 'vuex'

    export default {
        components: { iCopyright },
        data () {
            return {
                autoLogin: true
            }
        },
        methods: {
            ...mapActions('admin/account', ['login']),
            /**
             * @description 登录
             * 表单校验已有 iView Pro 自动完成，如有需要修改，请阅读 iView Pro 文档
             */
            handleSubmit (valid, values) {
                if (valid) {
                    const { username, password } = values
                    this.login({
                        username,
                        password
                    }).then(() => {
                        // 重定向对象不存在则返回顶层路径
                        this.$router.replace(this.$route.query.redirect || '/')
                    })
                }
            }
        }
    }
</script>
<style lang="less" scoped>
.page-account-top {
  padding-top: 100px;
    .page-account-top-desc{
      font-size: 40px;
    }
}
</style>
